import type {PageParam, PageResult} from '@vben/request';
import type {Dayjs} from 'dayjs';

import {requestClient} from '#/api/request';
export namespace PerPostExperienceApi {
  /** 岗位情况信息 */
  export interface PostExperience {
    id: number; // 主键ID
    employeeId?: number; // 人员ID，对应 per_employee.id
    postUnit: string; // 任职单位
    startDate: string | Dayjs; // 开始时间
    endDate: string | Dayjs; // 结束时间
    postType: string; // 岗位类别
    postLevel: string; // 岗位等级
    postFile: string; // 任职文件
    status: number; // 是否有效（1：有效，0：无效）
    remarks: string; // 备注
  }
}

/** 查询岗位情况分页 */
export function getPostExperiencePage(data: PageParam,desensitize: boolean,encrypt: boolean) {
  return requestClient.post<PageResult<PerPostExperienceApi.PostExperience>>('/per/post-experience/page', data,{ desensitize,encrypt });
}

/** 查询岗位情况详情 */
export function getPostExperience(id: number) {
  return requestClient.get<PerPostExperienceApi.PostExperience>(`/per/post-experience/get?id=${id}`);
}

/** 新增岗位情况 */
export function createPostExperience(data: PerPostExperienceApi.PostExperience) {
  return requestClient.post('/per/post-experience/create', data);
}

/** 修改岗位情况 */
export function updatePostExperience(data: PerPostExperienceApi.PostExperience) {
  return requestClient.put('/per/post-experience/update', data);
}

/** 删除岗位情况 */
export function deletePostExperience(id: number) {
  return requestClient.delete(`/per/post-experience/delete?id=${id}`);
}

/** 批量删除岗位情况 */
export function deletePostExperienceList(ids: number[]) {
  return requestClient.delete(`/per/post-experience/delete-list?ids=${ids.join(',')}`)
}

/** 导出岗位情况 */
export function exportPostExperience(params: any) {
  return requestClient.download('/per/post-experience/export-excel', { params });
}
